package io.renren.modules.avanotes.dao;

import io.renren.modules.avanotes.entity.VocabularyEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 英语单词词汇表
 * 
 * @author zzr
 * @email 529742454@qq.com
 * @date 2022-01-31 17:11:00
 */
@Mapper
public interface VocabularyDao extends BaseMapper<VocabularyEntity> {

    @Update("update vocabulary set is_match=1 where id=#{id}")
    void updateMatchById(Long id);

    @Select("select * from vocabulary where id>=#{id} and is_match=1 limit 1")
    VocabularyEntity getNext(Long id);

    VocabularyEntity getNextMatchById(Long id);
}
